<?
    class Principio_Model_SettingsMapper
    {
        const TEMPLATE_GLOBAL = 0;
        const TEMPLATE_EXT = 1;

        private static function reportException(Exception &$ex)
        {
            Principio_Library_Common::reportValidationFails("EXCEPTION: File: [".$ex->getFile().":".$ex->getLine()."] Reason: [".$ex->getMessage()."] Trace: [".$ex->getTraceAsString()."]");
        }


        private static $templates_array = array(
            self::TEMPLATE_GLOBAL => "/library/SPA/templates/global.cfg",
            self::TEMPLATE_EXT => "/library/SPA/templates/ext.cfg"
        );


        public static function getGlobalTemplates($template_type)
        {
            try
            {
                return file_get_contents(APPLICATION_PATH.self::$templates_array[$template_type]);
            }
            catch (Exception $ex)
            {
                return self::reportException($ex);
            };
        }


        public static function updateGlobalTemplates($template_type, &$template)
        {
            try
            {
                return file_put_contents(APPLICATION_PATH.self::$templates_array[$template_type], $template);
            }
            catch (Exception $ex)
            {
                return self::reportException($ex);
            };
        }


        public static function getAudioCodecs()
        {
            return "Default is G711a"; // :)
        }
    }
?>